import React from 'react'
import { Form, Input, Button, Checkbox } from 'antd';
import { UserOutlined, LockOutlined } from '@ant-design/icons';
import { connect } from 'umi'
import './index.less'
const Login = (props: any) => {
  console.log(props)
  const onFinish = (values: any) => {
    console.log('Received values of form: ', values);
    props.dispatch({
      type: 'user/loginEffect',
      payload: values
    })
  };

  return (
    <Form
      name="normal_login"
      className="login-form"
      initialValues={{ remember: true }}
      onFinish={onFinish}
    >
      <Form.Item
        name="adminname"
        rules={[{ required: true, message: '账户!' }]}
      >
        <Input prefix={<UserOutlined className="site-form-item-icon" />} placeholder="账户" />
      </Form.Item>
      <Form.Item
        name="password"
        rules={[{ required: true, message: '密码!' }]}
      >
        <Input
          prefix={<LockOutlined className="site-form-item-icon" />}
          type="password"
          placeholder="密码"
        />
      </Form.Item>

      <Form.Item>
        <Button type="primary" htmlType="submit" className="login-form-button">
          登录
        </Button>

      </Form.Item>
    </Form>
  );
};

export default connect()(Login)
